import request from '../utils/request'
let index = {
    namespace:'home',
    state:{
        num:0,
        data:{},
    },
    effects:{
        *changeNum({payload},{select,put,call}){
            //console.log(payload);
            //端口改变这个请求会报错
            let res =yield call(request('api/home.json'));
            //console.log(res);
            yield put({type:'changeData',payload:res.data})
        }
        
    },
    reducers:{
        changeData(state,{payload}){
            //console.log(payload);
            console.log(state);
            return{
                data:payload,
            }
        },
        func(state,{payload}){
            console.log(state)
            console.log(payload);
            return{
                
            }
        }
    },
}

export default index;